append_uint16 (output, parent_id);
}
-void
-broadway_output_window_update (BroadwayOutput *output,
- int id,
- guint32 texture)
-{
- write_header (output, BROADWAY_OP_WINDOW_UPDATE);
-
- append_uint16 (output, id);
- append_uint32 (output, texture);
-}
-
void
broadway_output_window_set_nodes (BroadwayOutput *output,
int id,
void broadway_output_set_transient_for (BroadwayOutput *output,
int id,
int parent_id);
-void broadway_output_window_update (BroadwayOutput *output,
- int id,
- guint32 texture);
void broadway_output_window_set_nodes (BroadwayOutput *output,
int id,
guint32 *data,
BROADWAY_REQUEST_SHOW_WINDOW,
BROADWAY_REQUEST_HIDE_WINDOW,
BROADWAY_REQUEST_SET_TRANSIENT_FOR,
- BROADWAY_REQUEST_UPDATE,
BROADWAY_REQUEST_MOVE_RESIZE,
BROADWAY_REQUEST_GRAB_POINTER,
BROADWAY_REQUEST_UNGRAB_POINTER,
guint32 parent;
} BroadwayRequestSetTransientFor;
-typedef struct {
- BroadwayRequestBase base;
- guint32 id;
- guint32 texture;
-} BroadwayRequestUpdate;
-
typedef struct {
BroadwayRequestBase base;
guint32 id;
BroadwayRequestShowWindow show_window;
BroadwayRequestHideWindow hide_window;
BroadwayRequestSetTransientFor set_transient_for;
- BroadwayRequestUpdate update;
BroadwayRequestMoveResize move_resize;
BroadwayRequestGrabPointer grab_pointer;
BroadwayRequestUngrabPointer ungrab_pointer;
return server->output != NULL;
}
-void
-broadway_server_window_update (BroadwayServer *server,
- gint id,
- guint32 texture)
-{
- BroadwayWindow *window;
-
- window = g_hash_table_lookup (server->id_ht, GINT_TO_POINTER (id));
- if (window == NULL)
- return;
-
- window->texture = texture;
-
- if (server->output != NULL)
- broadway_output_window_update (server->output, window->id,
- window->texture);
-}
-
void
broadway_server_window_set_nodes (BroadwayServer *server,
gint id,
broadway_output_window_set_nodes (server->output, window->id,
window->nodes, window->nodes_len);
- broadway_output_window_update (server->output, window->id,
- window->texture);
-
if (window->visible)
broadway_output_show_surface (server->output, window->id);
}
guint32 id);
cairo_surface_t * broadway_server_create_surface (int width,
int height);
-void broadway_server_window_update (BroadwayServer *server,
- gint id,
- guint32 texture);
void broadway_server_window_set_nodes (BroadwayServer *server,
gint id,
gint n_data,
restackWindows();
}
-function cmdWindowUpdate(id, texture_id)
-{
- var surface = surfaces[id];
- var texture_url = textures[texture_id];
-
- surface.div.src = texture_url;
-}
-
function handleNode(parent, node_data, data_pos)
{
var type = node_data[data_pos++];
cmdLowerSurface(id);
break;
- case 'b': // Update window
- id = cmd.get_16();
- var texture = cmd.get_32();
- cmdWindowUpdate(id, texture);
- break;
-
case 't': // Upload texture
id = cmd.get_32();
var data = cmd.get_data();
request->set_transient_for.id,
request->set_transient_for.parent);
break;
- case BROADWAY_REQUEST_UPDATE:
- global_id = GPOINTER_TO_INT (g_hash_table_lookup (client->textures,
- GINT_TO_POINTER (request->update.texture)));
- broadway_server_window_update (server,
- request->update.id,
- global_id);
- break;
case BROADWAY_REQUEST_SET_NODES:
{
gsize array_size = request->base.size - sizeof (BroadwayRequestSetNodes) + sizeof(guint32);
BROADWAY_REQUEST_SET_TRANSIENT_FOR);
}
-void
-_gdk_broadway_server_window_update (GdkBroadwayServer *server,
- gint id,
- guint32 texture)
-{
- BroadwayRequestUpdate msg;
-
- msg.id = id;
- msg.texture = texture;
-
- gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_UPDATE);
-}
-
static int
open_shared_memory (void)
{
GdkTexture *texture);
void gdk_broadway_server_release_texture (GdkBroadwayServer *server,
guint32 id);
-void _gdk_broadway_server_window_update (GdkBroadwayServer *server,
- gint id,
- guint32 texture);
void gdk_broadway_server_window_set_nodes (GdkBroadwayServer *server,
guint32 id,
GArray *nodes);
static void
update_dirty_windows_and_sync (void)
{
- GList *l;
GdkBroadwayDisplay *display;
- gboolean updated_surface;
display = GDK_BROADWAY_DISPLAY (find_broadway_display ());
g_assert (display != NULL);
- updated_surface = FALSE;
- for (l = display->toplevels; l != NULL; l = l->next)
- {
- GdkWindowImplBroadway *impl = l->data;
-
- if (impl->dirty)
- {
- GdkTexture *texture;
- guint32 texture_id;
-
- impl->dirty = FALSE;
- updated_surface = TRUE;
-
- if (impl->texture_id)
- gdk_broadway_server_release_texture (display->server, impl->texture_id);
- impl->texture_id = 0;
-
- texture = gdk_texture_new_for_surface (impl->surface);
- texture_id = gdk_broadway_server_upload_texture (display->server, texture);
- g_object_unref (texture);
-
- impl->texture_id = texture_id;
-
-
- if (impl->node_data)
- gdk_broadway_server_window_set_nodes (display->server, impl->id, impl->node_data);
-
- _gdk_broadway_server_window_update (display->server,
- impl->id,
- texture_id);
-
- }
- }
-
- /* We sync here to ensure all references to the impl->surface memory
- is done, as we may later paint new data in them. */
- if (updated_surface)
- gdk_display_sync (GDK_DISPLAY (display));
- else
- gdk_display_flush (GDK_DISPLAY (display));
+ gdk_display_flush (GDK_DISPLAY (display));
}
static guint flush_id = 0;
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
_gdk_broadway_server_destroy_window (broadway_display->server, impl->id);
- if (impl->texture_id)
- gdk_broadway_server_release_texture (broadway_display->server, impl->texture_id);
}
GdkCursor *cursor;
int id;
- int texture_id;
gboolean visible;
gboolean maximized;